package com.hi.cdi.versioning.domain;

import javax.validation.constraints.NotNull;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.layers.repository.mongo.RooMongoEntity;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooMongoEntity(identifierType = ObjectId.class)
@Document(collection = "books")
public class Book {

	@NotNull
	private String title;

	@NotNull
	private String author;

	@NotNull
	private double price;

	public Book() {

	}

	public static Book copyOf(Book book) {
		Book copy = new Book();
		copy.title = book.title;
		copy.author = book.author;
		copy.price = book.price;
		return copy;
	}
}
